

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Class AntColony &mdash; Path Planning  documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script type="text/javascript" src="../_static/jquery.js"></script>
        <script type="text/javascript" src="../_static/underscore.js"></script>
        <script type="text/javascript" src="../_static/doctools.js"></script>
        <script type="text/javascript" src="../_static/language_data.js"></script>
        <script type="text/javascript" src="../_static/collapsible-lists/js/CollapsibleLists.compressed.js"></script>
        <script type="text/javascript" src="../_static/collapsible-lists/js/apply-collapsible-lists.js"></script>
    
    <script type="text/javascript" src="../_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Class AStar" href="classAStar.html" />
    <link rel="prev" title="Class Ant" href="classAnt.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: white" >
          

          
            <a href="../index.html" class="icon icon-home"> Path Planning
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../algorithms.html">Algorithms</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#dijkstra">Dijkstra</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#a">A*</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#lpa">LPA*:</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#d-lite">D* Lite:</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#rrt">RRT</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#rrtstar">RRTStar</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#ant-colony-optimization">Ant Colony Optimization</a></li>
<li class="toctree-l2"><a class="reference internal" href="../algorithms.html#genetic-algorithm">Genetic Algorithm</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="library_root.html">Library API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="library_root.html#class-hierarchy">Class Hierarchy</a></li>
<li class="toctree-l2"><a class="reference internal" href="library_root.html#file-hierarchy">File Hierarchy</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="library_root.html#full-api">Full API</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="library_root.html#classes-and-structs">Classes and Structs</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="structcompare__cost.html">Struct compare_cost</a></li>
<li class="toctree-l4"><a class="reference internal" href="structpair__hash.html">Struct pair_hash</a></li>
<li class="toctree-l4"><a class="reference internal" href="classAnt.html">Class Ant</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">Class AntColony</a></li>
<li class="toctree-l4"><a class="reference internal" href="classAStar.html">Class AStar</a></li>
<li class="toctree-l4"><a class="reference internal" href="classDijkstra.html">Class Dijkstra</a></li>
<li class="toctree-l4"><a class="reference internal" href="classDStarLite.html">Class DStarLite</a></li>
<li class="toctree-l4"><a class="reference internal" href="classGeneticAlgorithm.html">Class GeneticAlgorithm</a></li>
<li class="toctree-l4"><a class="reference internal" href="classLPAStar.html">Class LPAStar</a></li>
<li class="toctree-l4"><a class="reference internal" href="classNode.html">Class Node</a></li>
<li class="toctree-l4"><a class="reference internal" href="classRRT.html">Class RRT</a></li>
<li class="toctree-l4"><a class="reference internal" href="classRRTStar.html">Class RRTStar</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="library_root.html#functions">Functions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="function_utils_8hpp_1a3314a5898aaa777e954abfa9f3996d41.html">Function GetMotion</a></li>
<li class="toctree-l4"><a class="reference internal" href="function_main_8hpp_1ae66f6b31b5ad750f1fe042a706a4e3d4.html">Function main</a></li>
<li class="toctree-l4"><a class="reference internal" href="function_utils_8hpp_1ad8afc8a6d98fae87fffe3ad0621eaf4b.html">Function MakeGrid</a></li>
<li class="toctree-l4"><a class="reference internal" href="function_utils_8hpp_1a012ce27d2ee6c480975c0cfa6944104a.html">Function PrintCost</a></li>
<li class="toctree-l4"><a class="reference internal" href="function_utils_8hpp_1ae78f95d1e36b0989a307b951da25532e.html">Function PrintGrid</a></li>
<li class="toctree-l4"><a class="reference internal" href="function_utils_8hpp_1a557054c14922455add5f4b8ab1616ab0.html">Function PrintPath</a></li>
<li class="toctree-l4"><a class="reference internal" href="function_utils_8hpp_1a361bc10e4ced98ae2a1eef33a768c43c.html">Function PrintPathInOrder</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="library_root.html#defines">Defines</a><ul>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1a7b3b25cba33b07c303f3060fe41887f6.html">Define BLACK</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1a79d10e672abb49ad63eeaa8aaef57c38.html">Define BLUE</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1ad243f93c16bc4c1d3e0a13b84421d760.html">Define CYAN</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1acfbc006ea433ad708fdee3e82996e721.html">Define GREEN</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_lpa__star_8hpp_1a5bd181e29d3aa3a1daeb348c8ddada44.html">Define LPA_STAR__H</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1a6f699060902f800f12aaae150f3a708e.html">Define MAGENTA</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1a8d23feea868a983c8c2b661e1e16972f.html">Define RED</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1ab702106cf3b3e96750b6845ded4e0299.html">Define RESET</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1a87b537f5fa5c109d3c05c13d6b18f382.html">Define WHITE</a></li>
<li class="toctree-l4"><a class="reference internal" href="define_utils_8hpp_1abf681265909adf3d3e8116c93c0ba179.html">Define YELLOW</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="library_root.html#directories">Directories</a><ul>
<li class="toctree-l4"><a class="reference internal" href="dir_inc.html">Directory inc</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="library_root.html#files">Files</a><ul>
<li class="toctree-l4"><a class="reference internal" href="file_inc_a_star.hpp.html">File a_star.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_ant_colony.hpp.html">File ant_colony.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_d_star_lite.hpp.html">File d_star_lite.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_dijkstra.hpp.html">File dijkstra.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_genetic_algorithm.hpp.html">File genetic_algorithm.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_lpa_star.hpp.html">File lpa_star.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_main.hpp.html">File main.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_README.md.html">File README.md</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_rrt.hpp.html">File rrt.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_rrt_star.hpp.html">File rrt_star.hpp</a></li>
<li class="toctree-l4"><a class="reference internal" href="file_inc_utils.hpp.html">File utils.hpp</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">Path Planning</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html">Docs</a> &raquo;</li>
        
          <li><a href="library_root.html">Library API</a> &raquo;</li>
        
      <li>Class AntColony</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../_sources/api/classAntColony.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="class-antcolony">
<span id="exhale-class-classantcolony"></span><h1>Class AntColony<a class="headerlink" href="#class-antcolony" title="Permalink to this headline">¶</a></h1>
<ul class="simple">
<li>Defined in <a class="reference internal" href="file_inc_ant_colony.hpp.html#file-inc-ant-colony-hpp"><span class="std std-ref">File ant_colony.hpp</span></a></li>
</ul>
<div class="section" id="class-documentation">
<h2>Class Documentation<a class="headerlink" href="#class-documentation" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="_CPPv39AntColony">
<span id="_CPPv29AntColony"></span><span id="AntColony"></span><span class="target" id="classAntColony"></span><em class="property">class </em><code class="descname">AntColony</code><a class="headerlink" href="#_CPPv39AntColony" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Class for <a class="reference internal" href="classAnt.html#classAnt"><span class="std std-ref">Ant</span></a> Colony objects. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv3N9AntColony9AntColonyEidddid">
<span id="_CPPv2N9AntColony9AntColonyEidddid"></span><span id="AntColony::AntColony__i.double.double.double.i.double"></span><span class="target" id="classAntColony_1a6529739399d221980b266dbd2e8c28a3"></span><code class="descname">AntColony</code><span class="sig-paren">(</span>int <em>n_ants</em> = 10, double <em>alpha</em> = 0.5, double <em>beta</em> = 0.5, double <em>evap_rate</em> = 0.5, int <em>iterations</em> = 10, double <em>Q</em> = 10.0<span class="sig-paren">)</span><a class="headerlink" href="#_CPPv3N9AntColony9AntColonyEidddid" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Constructor for set up of <a class="reference internal" href="classAnt.html#classAnt"><span class="std std-ref">Ant</span></a> Colony class. </p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>no return value </dd>
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">n_ants</span></code>: number of ants yo be created in every iterations </li>
<li><code class="docutils literal notranslate"><span class="pre">alpha</span></code>: value of exponent for the use of the pheromone trails in assigning probability to possible next positions </li>
<li><code class="docutils literal notranslate"><span class="pre">beta</span></code>: value of exponent for the use of the heuristic in assigning probability to possible next positions </li>
<li><code class="docutils literal notranslate"><span class="pre">evap_rate</span></code>: evaporation rate of the pheromone trail as a value between 0 and 1 </li>
<li><code class="docutils literal notranslate"><span class="pre">iterations</span></code>: number of iterations of the simulation </li>
<li><code class="docutils literal notranslate"><span class="pre">Q</span></code>: Constant multiplication factor for the cost/reward function </li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv3N9AntColony12PrintAntPathER3Ant">
<span id="_CPPv2N9AntColony12PrintAntPathER3Ant"></span><span id="AntColony::PrintAntPath__AntR"></span><span class="target" id="classAntColony_1afaa873af1ce05663d1948aa65f82b3ea"></span>void <code class="descname">PrintAntPath</code><span class="sig-paren">(</span><a class="reference internal" href="classAnt.html#_CPPv33Ant" title="Ant">Ant</a> &amp;<em>ant</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv3N9AntColony12PrintAntPathER3Ant" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Prints the path taken by the ant. </p>
<p><p>Prints the path taken by the ant on the grid, using the PrintPath function in utils.cpp. It can be used to print incomplete paths as well, as long as the end point and start point are specified. </p>
<dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>void</dd>
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">ant</span></code>: ant for which the path is to be printed. </li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv3N9AntColony10RemoveLoopER3Ant">
<span id="_CPPv2N9AntColony10RemoveLoopER3Ant"></span><span id="AntColony::RemoveLoop__AntR"></span><span class="target" id="classAntColony_1a300665d4d1bbc0a0b04cc5da45162109"></span>void <code class="descname">RemoveLoop</code><span class="sig-paren">(</span><a class="reference internal" href="classAnt.html#_CPPv33Ant" title="Ant">Ant</a> &amp;<em>ant</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv3N9AntColony10RemoveLoopER3Ant" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Removes loops in path. </p>
<p><p>Removes loops in path of an ant only when a point is revisted. </p>
<dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>void</dd>
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">ant</span></code>: <a class="reference internal" href="classAnt.html#classAnt"><span class="std std-ref">Ant</span></a> in whose path the loops are to be removed </li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv3N9AntColony10ant_colonyERNSt6vectorINSt6vectorIiEEEE4Node4Node">
<span id="_CPPv2N9AntColony10ant_colonyERNSt6vectorINSt6vectorIiEEEE4Node4Node"></span><span id="AntColony::ant_colony__std::vector:std::vector:i::R.Node.Node"></span><span class="target" id="classAntColony_1a22fba6f705d52f185a454257224ec8d8"></span>std::vector&lt;<a class="reference internal" href="classNode.html#_CPPv34Node" title="Node">Node</a>&gt; <code class="descname">ant_colony</code><span class="sig-paren">(</span>std::vector&lt;std::vector&lt;int&gt;&gt; &amp;<em>grid</em>, <a class="reference internal" href="classNode.html#_CPPv34Node" title="Node">Node</a> <em>start</em>, <a class="reference internal" href="classNode.html#_CPPv34Node" title="Node">Node</a> <em>goal</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv3N9AntColony10ant_colonyERNSt6vectorINSt6vectorIiEEEE4Node4Node" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Main algorithm of ant colony optimization. </p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>best path within last iteration of the ant colony </dd>
<dt><strong>Parameters</strong></dt>
<dd><ul class="breatheparameterlist first last simple">
<li><code class="docutils literal notranslate"><span class="pre">grid</span></code>: Main grid </li>
<li><code class="docutils literal notranslate"><span class="pre">start</span></code>: start node </li>
<li><code class="docutils literal notranslate"><span class="pre">goal</span></code>: goal node </li>
</ul>
</dd>
</dl>
</p>
</dd></dl>

</div>
</dd></dl>

</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="classAStar.html" class="btn btn-neutral float-right" title="Class AStar" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="classAnt.html" class="btn btn-neutral float-left" title="Class Ant" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, vss2sn

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>